<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            height: 3000px;
            border: 1px solid black;
            position: relative;
        }
        .dead{
            margin:1400px auto;
            height: 200px;
            background-color: aqua;
            text-align: center;
            line-height: 200px;
            font-size: 50px;
            color: white;
            cursor: grab;
            transition: all 0.5s;
        }
        .dead:hover{
            box-shadow: 2px 6px 10px rgb(189, 48, 6);
            margin:1380px auto;
        }
        .show{
            margin-top: 0;
            height: 3000px;
            background-color: red;
        }
    </style>
    <script>
        window.addEventListener('load',function(){
            const div = document.querySelector('div')
           window.addEventListener('scroll',function(){
               console.log(document.documentElement.scrollTop)
               if (document.documentElement.scrollTop >= 1000){

                   div.style.backgroundColor = 'red'
                   div.innerHTML = 'You dead!'
                //    div.classList.add('show')
               }else{
                    div.style.backgroundColor = 'aqua'
                    div.innerHTML = ''
                    // div.classList.remove('show')
               }
           })
           div.addEventListener('click',function(){
                window.scrollTo(0,0)
           })
         })
    </script>
</head>
<body>
    <div class="dead">

    </div>
    <div class="hint">返回头部</div>
    <script>

    </script>
</body>
</html>
